home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / REFERENC / TPR / TPR8.TXT < prev    next >
Text File  |  1992-10-19  |  72KB  |  1,854 lines

  1.                                    Chapter 8
  2.                                     of the
  3.                             Turbo Pascal Reference
  4.  
  5.                           The Turbo Vision Reference
  6.                                   (continued)
  7.  
  8.  
  9. This chapter is part of the Turbo Pascal Reference electronic freeware book (C)
  10. Copyright 1992 by Ed Mitchell.  This freeware book contains supplementary
  11. material to Borland Pascal Developer's Guide, published by Que Corporation,
  12. 1992.  However, Que Corporation has no affiliation with nor responsibility for
  13. the content of this free book.  Please see Chapter 1 of the Turbo Pascal
  14. Reference for important information about your right to distribute and use this
  15. material freely.  If you find this material of use, I would appreciate your
  16. purchase of one my books, such as the Borland Pascal Developer's Guide or
  17. Secrets of the Borland C++ Masters, Sams Books, 1992.  Thank you.
  18.  
  19. For additional information on using Turbo Vision, including a detailed
  20. tutorial, please see Chapters 11 through 16 of the Borland Pascal Developer's
  21. Guide.
  22.  
  23.  
  24. RepeatDelay variable
  25. ------------------------------------------------------------ 
  26. Declaration:   RepeatDelay: Word = 8;
  27.  
  28. Unit:          Drivers
  29.  
  30. Purpose:
  31.      Determines the number of clock ticks that must occur before generating an
  32.      evMouseAuto event.  evMouseAuto events are automatically generated while
  33.      the mouse button is held down.  A clock tick is 1/18.2 seconds, so the
  34.      default value of 8/18.2 is set at approximately 1/2 second.
  35.      See:  evXXXX constants, DoubleDelay
  36.  
  37.  
  38. SaveCtrlBreak variable
  39. ------------------------------------------------------------ 
  40. Declaration:   SaveCtrlBreak: Boolean = False;
  41.  
  42. Unit:          Drivers
  43.  
  44. Purpose:
  45.      This internal variable is set to the state of the DOS Ctrl-break checking
  46.      at program initialization; at program termination, DOS's Ctrl-break
  47.      trapping is restored to the value saved in SaveCtrlBreak.
  48.      See:  InitSysError, DoneSysError
  49.  
  50.  
  51. sbXXXX constants
  52. ------------------------------------------------------------ 
  53. Scrollbar constants
  54.  
  55. Constant        Value Usage
  56. sbLeftArrow     0     The horizontal scroll bar's left arrow.
  57. sbRightArrow    1     Horizontal scroll bar's right arrow.
  58. sbPageLeft      2     The page area to the left of the position
  59.                       indicator.
  60. sbPageRight     3     The page indicator to the right of the
  61.                       indicator.
  62. sbUpArrow       4     Vertical scroll bar's up arrow.
  63. sbDownArrow     5     Vertical scroll bar's down arrow.
  64. sbPageUp        6     Paging area above the position indicator.
  65. sbPageDown      7     Paging area below the position indicator.
  66. sbIndicator     8     Position indicator on the scroll bar.
  67. sbHorizontal    $0000 The scroll bar is horizontal.
  68. sbVertical      $0001 The scroll bar is vertical.
  69. sbHandleKeyboard      $0002   Scroll bar accepts keyboard commands.
  70.  
  71. Use one of the first 9 sbXXXX constants as a parameter to
  72. TScrollBar.ScrollStep.  The last 3 sbXXXX constants, sbHorizontal, sbVertical,
  73. sbHandleKeyboard are used to specify a horizontal, vertical, or keyboard
  74. accessable scrollbar when a scroll bar is created using the
  75. TWindow.StandardScrollBar function.
  76.  
  77. See:  TScrollBar.ScrollStep, TScrollBar, TWindow.StandardScrollBar
  78.  
  79.  
  80. ScreenBuffer variable
  81. ------------------------------------------------------------ 
  82. Declaration:          ScreenBuffer: Pointer;
  83.  
  84. Unit:                 Drivers
  85.  
  86. Purpose:
  87.      This internal pointer is initialized by InitVideo and keeps track of the
  88.      location of the video screen buffer.
  89.  
  90.  
  91. ScreenHeight variable
  92. ------------------------------------------------------------ 
  93. Declaration:          ScreenHeight : Byte;
  94.  
  95. Unit:                 Drivers
  96.  
  97. Purpose:
  98.      Holds the current height of the screen, in lines.  For example, 25, 43 or
  99.      50 would be typical values.
  100.      See:  SetVideoMode
  101.  
  102.  
  103. ScreenMode variable
  104. ------------------------------------------------------------ 
  105. Declaration:          ScreenMode : Word;
  106.  
  107. Unit:                 Drivers
  108.  
  109. Purpose:
  110.      Contains the current video mode as determined by the smXXXX constants
  111.      passed to the SetVideoMode procedure.
  112.      See:  SetVideoMode, smXXXX constants
  113.  
  114.  
  115. ScreenWidth variable
  116. ------------------------------------------------------------
  117. Declaration:          ScreenWidth : Byte;
  118.  
  119. Unit:                 Drivers
  120.      Holds the current width of the screen in number of characters per line
  121.      (for example, 80).
  122.  
  123.  
  124. SetMemTop procedure
  125. ------------------------------------------------------------
  126. Declaration:  
  127.      procedure SetMemTop(MemTop : Pointer);
  128.  
  129. Unit:  Memory
  130.  
  131. Purpose:
  132.      SetMemTop sets the top of the memory block allocated to an application. 
  133.      Initially, MemTop is set to the top of the heap, stored in HeapEnd.  By
  134.      resetting the top of memory to the HeapPtr, all the remaining free memory
  135.      is available for other uses.  This is especially useful when shelling out
  136.      to another application, as shown in this example code from TVSHELL8.PAS
  137.      (see Chapters 11-12 in Borland Pascal Developer's Guide):
  138.  
  139. procedure TShell.RunProgram ( ProgName, ParamStr : String );
  140.      { Launches the program in 'ProgName' with the command line
  141.        parameters in 'ParamStr' }
  142. begin
  143.   ClrScr;
  144.   DoneSysError;
  145.   DoneEvents;
  146.   DoneVideo;
  147.   DoneMemory;
  148.   SetMemTop(HeapPtr);
  149.   SwapVectors;
  150.   Exec( ProgName, ParamStr );
  151.   SwapVectors;
  152.   SetMemTop(HeapEnd);
  153.   InitMemory;
  154.   InitVideo;
  155.   InitEvents;
  156.   InitSysError;
  157.   Shell.ReDraw;
  158. end; { RunProgram }
  159.  
  160.  
  161. SelectMode type
  162. ------------------------------------------------------------ 
  163. Declaration:       
  164.      SelectMode = (NormalSelect, EnterSelect, LeaveSelect);
  165.  
  166. Unit:     Views
  167.  
  168. Purpose:
  169.      An internal value used by Turbo Vision.
  170.  
  171.  
  172. SetVideoMode procedure
  173. ------------------------------------------------------------ 
  174. Declaration:
  175.      procedure SetVideoMode( Mode: Word );
  176.  
  177. Unit:              Drivers
  178.  
  179. Purpose:
  180.      Use this (or more commonly TProgram.SetScreenMode) to select 25 or 43/50
  181. line screen height, in conjunction with selecting the color, black & white or
  182. monochrome palettes.  To change to the  color palette, write,
  183.      SetVideoMode( smCO80 );
  184. where smCO80 is one of the smXXXX screen mode constants.  Optionally, to select
  185. 43/50 line mode, add the smFont8x8 constant to the color selection constant. 
  186. For example,
  187.      SetVideoMode( smMono + smFont8x8 );
  188. Normally, you should use TProgram.SetScreenMode, which has the same parameter
  189. value, to change the screen color or screen size.  SetScreenMode properly
  190. handles resetting of the application palettes, repositioning the mouse pointer
  191. and so on.
  192.  
  193. See:  TProgram.SetScreenMode, smXXXX constants
  194.  
  195.  
  196. sfXXXX constants
  197. ------------------------------------------------------------ 
  198. State Flag constants
  199.  
  200.      Use TView.SetState to set the state bits, from the table below, into a
  201. TView's State field.  Example usage:
  202.      SetState( sfCursorIns, True );
  203. where the first parameter is the state value to change, and the second
  204. parameter is True to enable the selected condition, or False to disable the
  205. selected condition.  Some of the bits are not normally set by the programmer
  206. but rather by methods in Turbo Vision.  You can, however, read and test the
  207. values in TView.State directly.
  208.  
  209. Constant  Value    Usage
  210. sfVisible $0001
  211.                     Set when the view is visible in front of its owner (for
  212.                     example, a button on a dialog) but note that a visible
  213.                     view's owner may itself be hidden from view.  Call
  214.                     TView.Exposed to determine if a view is actually visible on
  215.                     the screen, and use TView.Hide to clear this bit and hide
  216.                     the view, and TView.Show to set this bit and make the view
  217.                     visible.
  218.  
  219. sfCursorVis        $0002
  220.                     Set when the view's cursor is visible.  Use
  221.                     TView.ShowCursor to make the cursor visible and set this
  222.                     bit, or TView.HideCursor to hide the cursor and clear this
  223.                     bit.
  224.  
  225. sfCursorIns        $0004
  226.                     Set when the cursor is a solid block (the "insert" cursor),
  227.                     clear when the cursor is an underscore (the "overstrike"
  228.                     cursor).  Call TView.BlockCursor to set this bit, and
  229.                     TView.NormalCursor to clear the bit.
  230.  
  231. sfShadow  $0008
  232.                     Set when the view has a shadow.
  233.  
  234. sfActive  $0010
  235.                     Set whenever the view is an active window or a subview
  236.                     within an active window.  For example, when using the IDE
  237.                     to edit multiple files, only the editor that you are
  238.                     currently using is the active window.
  239.  
  240. sfSelected         $0020
  241.                     Set when this view is selected.  (See TView.Selected).
  242.  
  243. sfFocused $0040
  244.                     If the view is part of the focus chain (see Chapter 13,
  245.                     "More Turbo Vision Features" in the Borland Pascal
  246.                     Developer's Guide), then this bit is set.
  247.  
  248. sfDragging         $0080
  249.                     Set whenever the view is being dragged.
  250.  
  251. sfDisabled         $0100
  252.                     Set if the view has been disabled and is no longer
  253.                     processing events.
  254.  
  255. sfModal   $0200
  256.                     Whenever a view is displayed using the ExecView call, that
  257.                     view becomes a modal view (as compared to a view that has
  258.                     been inserted into the desktop).  This bit is set when the
  259.                     view is the modal view and controls how events are sent
  260.                     through the view hierarchy.
  261.  
  262. sfExposed $0800
  263.                     Set when a view is possibly visible on the screen.  Don't
  264.                     check this flag directly because a visible view can still
  265.                     be hidden due to clipping.  Instead, call TView.Exposed to
  266.                     determine if the view is actually visible.
  267.  
  268. See:  TView.BlockCursor,  TView.Exposed, TView.Hide, TView.HideCursor,
  269. TView.NormalCursor, TView.SetState, TView.Show, TView.ShowCursor, 
  270.  
  271.  
  272. ShadowAttr variable
  273. ------------------------------------------------------------ 
  274. Declaration:
  275.      ShadowAttr: Byte = $08;
  276.  
  277. Unit:              Views
  278. Purpose:
  279.      The ShadowAttr byte contains the video attribute for the color of the
  280.      shadow display on some views and windows.  See Chapter 13, "More Turbo
  281.      Vision Features" in the Borland Pascal Developer's Guide for details on
  282.      selecting different colors for video attribute bytes
  283.      See:  ShadowSize
  284.  
  285.  
  286. ShadowSize variable
  287. ------------------------------------------------------------ 
  288. Declaration:
  289.      ShadowSize: TPoint = (X: 2; Y: 1);
  290.  
  291. Unit:              Views
  292. Purpose:
  293.      ShadowSize determines the size of the shadow area on those views that
  294.      contain a shadow.  The default value is 2 characters wide and 1 character
  295.      high.
  296.      See: ShadowAttr
  297.  
  298.  
  299. ShowMarkers variable
  300. ------------------------------------------------------------ 
  301. Declaration:
  302.      ShowMarkers: Boolean;
  303.  
  304. Unit:              Drivers
  305.  
  306. Purpose:
  307.      When using color displays, Turbo Vision uses different colors to highlight
  308. the default button selections, the location of the list box cursor and so on. 
  309. When using the monochrome color palette, Turbo Vision adds small marker
  310. characters to various controls to make them easier to identify and when
  311. necessary to highlight a default selection.  For example, default buttons have
  312. small right and left arrows to highlight the default button:
  313.  
  314.      -> [ Okay ] <-     [Cancel]
  315.  
  316. When the monochrome color palette is selected, ShowMarkers is set to True and
  317. is normally set False for the other color palettes.  If you wish, you can set
  318. ShowMarkers True for both CColor and CBlackWhite palettes.
  319.  
  320.  
  321. ShowMouse procedure
  322. ------------------------------------------------------------ 
  323. Declaration:
  324.      procedure ShowMouse
  325.  
  326. Unit:              Drivers
  327.  
  328. Purpose:
  329.      ShowMouse is the opposite of the HideMouse.  Call HideMouse to hide the
  330.      mouse cursor and simultaneously increment a "mouse hidden counter". 
  331.      ShowMouse decrements the counter, and when it reaches zero, makes the
  332.      mouse cursor visible again on the screen.
  333.      See: HideMouse
  334.  
  335.  
  336. smXXXX constants
  337. ------------------------------------------------------------ 
  338. Screen Mode Constants
  339.  
  340. Use the constants from the table below when selecting Black & White, Color or
  341. Monochrome color palettes, or switching between 25 and 43- or 50 line display
  342. modes.  Use of these constants is described in "The Set Up Program Dialog" in
  343. Chapter 12, and also in Chapter 13 of the Borland Pascal Developer's Guide.
  344.  
  345. Constant  Value    Usage
  346. smBW80    $0002    Black and white/gray scale
  347. smCO80    $0003    Color mode
  348. smMono    $0004    Monochrome mode
  349. smFont8x8 $0100    43 or 50 line modes
  350.  
  351. See: SetVideoMode, ScreenMode, TProgram.SetScreenMode
  352.  
  353.  
  354. SpecialChars variable
  355. ------------------------------------------------------------ 
  356. Declaration:
  357.      SpecialChars: array [0..5] of Char =
  358.           (#175, #174, #26, #27, ' ', ' ')
  359.  
  360. Unit:              Views
  361.  
  362. Purpose:
  363.      These constants define the special marker characters used when the
  364.      ShowMarkers variable is set to True.
  365.      See: ShowMarkers
  366.  
  367.  
  368. stXXXX constants
  369. ------------------------------------------------------------
  370. Stream constants
  371.  
  372. These constants are used when opening a stream file, to specify the access
  373. mode, and by the streams system to return error condition codes.  For
  374. additional information, see Chapter 21, Streams.
  375.  
  376. Stream access modes passed to the TStream.Init constructor
  377. Constant    Value  Usage
  378. stCreate    $3C00  Create and open the file
  379. stOpenRead  $3D00  Open an existing file as a read-only file
  380. stOpenWrite $3D01  Open an existing file as write-only.
  381. stOpen      $3D02  Open an existing file with read/write access
  382.  
  383. Stream error codes set in TStream.Status
  384. Constant    Value  Usage
  385. stOk         0     No error
  386. stError     -1     Access error occurred
  387. stInitError -2     Unable to initialize the stream
  388. stReadError -3     An attempt was made to read past the end of
  389.                    the file
  390. stWriteError       -4            For some reason (perhaps out of disk space)
  391.                    the stream could not be expanded.
  392. stGetError  -5     An unregistered object type was found in the
  393.                    file by the Get method.
  394. stPutError  -6     Put tried to write an unregistered object
  395.                    type to the stream
  396.  
  397.  
  398. StartupMode variable
  399. ------------------------------------------------------------ 
  400. Declaration:       
  401.      StartupMode : Word;
  402.  
  403. Unit:              Drivers
  404.  
  405. Purpose:
  406.      This internal variable stores the existing screen mode before Turbo Vision
  407.      switches to a new screen mode.
  408.      See:  DoneVideo, ScreenMode 
  409.  
  410.  
  411. StatusLine variable
  412. ------------------------------------------------------------ 
  413. Declaration:       
  414.      StatusLine: PStatusLine = nil;
  415.  
  416. Unit:              App
  417.  
  418. Purpose:
  419.      StatusLine is initialized by the call to TProgram.InitStatusLine.   See
  420.      Chapter 14, Turbo Vision Tutorial for a detailed description of
  421.      initialization a program's status line.
  422.  
  423.  
  424. StreamError variable
  425. ------------------------------------------------------------ 
  426. Declaration:       
  427.      StreamError: Pointer = nil;
  428.  
  429. Unit:              Objects
  430.  
  431. Purpose:
  432.      To override all stream error handling, set StreamError to point to a far
  433. procedure that you have defined.  Thereafter, whenever any error occurs, on any
  434. stream that is in use, your procedure will receive control.  This enables you
  435. to write a single procedure to intercept and process all stream error
  436. conditions.  Alternately, you can override TStream.Error to intercept error
  437. conditions for individual streams.
  438.      Example usage:
  439.      procedure HandleStreamErr( var S : TStream); far;
  440.      ...
  441.      StreamError := @HandleStreamErr;
  442.  
  443.  
  444. SysColorAttr variable
  445. ------------------------------------------------------------ 
  446. Declaration:       
  447.      SysColorAttr: Word = $4E4F;
  448.  
  449. Unit:              Drivers
  450.  
  451. Purpose:
  452.      On color displays, SysColorAttr specifies the attribute bytes for system
  453.      error messages.  (SysMonoAttr specifies the attribute bytes for monochrome
  454.      ). System error messages are DOS crtical errors (such as floppy disk drive
  455.      not accessible) and other device type errors.  System errors are displayed
  456.      on the status line in the color specified by the second part of 
  457.      SysColorAttr, $4F, white on red text.  The first part, $4E, is used for
  458.      highlighting command keys, such as Enter or Esc.
  459.      See:   SystemError, SysMonoAttr, Chapter 13, "More Turbo Vision Features".
  460.  
  461.  
  462. SysErrActive variable
  463. ------------------------------------------------------------ 
  464. Declaration:       
  465.      SysErrActive : Boolean = False;
  466.  
  467. Unit:              Drivers
  468.  
  469. Purpose:
  470.             If True, then the system error handler is available for use.
  471.  
  472.  
  473. SysErrorFunc variable
  474. ------------------------------------------------------------ 
  475. Declaration:       
  476.      SysErrorFunc : TSysErrorFunc = SystemError;
  477.  
  478. Unit:              Drivers
  479.  
  480. Purpose:
  481.      SysErrorFunc points to the system error handling procedure.  You can
  482. override system error handling by writing your own procedure and assigning it
  483. to the SysErrorFunc variable.  The default system error handler is defined as,
  484.  
  485.      function SystemError
  486.             (ErrorCode: Integer; Drive: Byte): Integer;
  487.  
  488. where ErrorCode is a value from the table below, and Drive is the drive number
  489. (A=1, B=1, C=3, and so on).  SystemError should return 0 if the user requests
  490. to retry the operation or 1 if the user elected to abort the function.
  491.  
  492. Table of System Error Codes
  493. Error code  Usage
  494. 0           Disk is write protected
  495. 1           Critical disk error
  496. 2           Disk is not ready
  497. 3           Critical disk error
  498. 4           Data integrity error
  499. 5           Critical disk error
  500. 6           Seek error
  501. 7           Unknown media type
  502. 8           Sector not found
  503. 9           Printer out of paper
  504. 10          Write fault
  505. 11          Read fault
  506. 12          Hardware failure       
  507. 13          Bad memory image of file allocation table
  508. 14          Device access error
  509. 15          Drive swap notification (floppy disks have changed)
  510.  
  511. See:  SysColorAttr, SysErrActive, SysErrorFunc, SysMonoAttr, SystemError,
  512. TSysErrorFunc, InitSysError
  513.  
  514.  
  515. SysMonoAttr variable
  516. ------------------------------------------------------------ 
  517. Declaration:       
  518.      SysMonoAttr: Word = $7070;
  519.  
  520. Unit:              Drivers
  521.  
  522. Purpose:
  523.      On monochrome displays, SysMonoAttr specifies the attribute bytes for
  524.      system error messages.  (SysColorAttr specifies the attribute bytes for
  525.      color). System error messages are DOS crtical errors (such as floppy disk
  526.      drive not accessible) and other device type errors.  See SysColorAttr for
  527.      more information about the attribute values.
  528.      See:   SystemError, SysColorAttr, Chapter 13, "More Turbo Vision Features"
  529.      in Borland Pascal Developer's Guide.
  530.  
  531.  
  532. SystemError function
  533. ------------------------------------------------------------ 
  534. Declaration:       function SystemError( ErrorCode: Integer;  Drive:Byte):
  535. Integer;
  536.  
  537. Unit:              Drivers
  538.  
  539. Purpose:
  540.      This function handles system errors (such as DOS critical errors).  See
  541.      SysErrorFunc for details on the parameters and their values.  SystemError
  542.      returns 0 if the user requests that the operation be retried, and 1 if the
  543.      user elects to cancel the operation.
  544.      See:  SysErrorFunc          
  545.  
  546.  
  547. TApplication object
  548. ------------------------------------------------------------ 
  549. Turbo Vision Hierarchy
  550.   TObject
  551.      TView
  552.        TGroup
  553.           TProgram
  554.             TApplication
  555.  
  556. Discussion
  557.      The TApplication object is the generic application from which most of the
  558.      Turbo Vision programs you write will be derived.  For examples, see the
  559.      TVSHELL  sample programs of Chapters 11-12 in the Borland Pascal
  560.      Developer's Guide.  As shown in Listing 11.1 (of the Developer's Guide),
  561.      TShell is defined as an instance of TApplicatio.  TApplication is nearly
  562.      identical to TProgram; the only difference is in the Init and Done
  563.      destructors.  
  564.  
  565. Commonly Used Features
  566.      Generally, the only methods used are TApplication.Init, TApplication.Done,
  567.      and TApplication.Run, which is inherited from TProgram.Run.  See also
  568.      TProgram for other methods that are available to TApplication objects.
  569.  
  570. Example
  571. type
  572.   TShell = object(TApplication)
  573.     DirWindow : PDirectoryWindow;
  574.  
  575.     procedure InitMenuBar; virtual;
  576.     procedure InitStatusLine; virtual;
  577.     constructor Init;
  578.   end; { TShell }
  579.  
  580. var
  581.   Shell     : TShell;       { Create an instance of the TShell object }
  582.  
  583.  
  584. procedure TShell.InitMenuBar;
  585. { Purpose:
  586.   Defines the pulldown menus used in Shell
  587. }
  588. var
  589.   Bounds: TRect;
  590.  
  591. begin
  592.  
  593.   TShell.GetExtent(Bounds);
  594.   Bounds.B.Y := Bounds.A.Y + 1;
  595.   MenuBar := New(PMenuBar, Init(Bounds, NewMenu(
  596.     NewSubMenu('~R~un', hcNoContext, NewMenu(
  597.       NewItem('~R~un', '', 0, cmRunProgram, hcNoContext,
  598.   ...
  599. end;
  600.  
  601.  
  602. procedure TShell.InitStatusLine;
  603.  
  604. { Purpose:
  605.   Defines the Status Line shown on the bottom line of the screen
  606.   within TShell
  607. }
  608. var
  609.   Bounds: TRect;
  610.  
  611. begin
  612.   GetExtent(Bounds);
  613.   Bounds.A.Y := Bounds.B.Y - 1;
  614.   StatusLine := New(PStatusLine, Init(Bounds,
  615.     NewStatusDef(0, $FFFF,
  616.       NewStatusKey('', kbF10, cmMenu,
  617.       NewStatusKey('~Alt-X~ Exit', kbAltX, cmQuit,
  618.       NewStatusKey('~F2~ Copy', kbF2, cmCopy,
  619.       NewStatusKey('~F3~ Close', kbF3, cmClose,
  620.       nil)))),
  621.     nil)
  622.   ));
  623. end; { TShell.InitStatusLine }
  624.  
  625.  
  626. constructor TShell.Init;
  627.  
  628. var
  629.   Bounds : TRect;
  630.  
  631. begin
  632.   TApplication.Init;
  633. end; { TShell.Init }
  634.  
  635.  
  636. begin
  637.  
  638.   Shell.Init;
  639.   Shell.Run;
  640.   Shell.Done;
  641.  
  642. end.
  643.  
  644.  
  645. Fields
  646.      none
  647.  
  648. Methods
  649.  
  650. destructor  Done; virtual;
  651.      Calls TProgram.Done, DoneHistory, DoneSysError, DoneEvents, DoneVideo, and
  652.      DoneMemory.
  653.  
  654. constructor Init;
  655.        Calls InitMemory, InitVideo, InitEvents, InitSysError, InitHistory and
  656.      TProgram.Init.
  657.  
  658.  
  659.  
  660. TBackground object
  661. ------------------------------------------------------------ 
  662. Turbo Vision Hierarchy
  663.   TObject
  664.      TView
  665.        TBackground
  666.  
  667. Discussion
  668.      TBackground contains the background pattern that forms the backdrop of
  669.      most Turbo Vision applications.  TBackground is automatically initialized
  670.      by the TDeskTop object that owns all of the application views.  
  671.  
  672. Commonly Used Features
  673.        Normally, you will have no need to directly use the TBackground object. 
  674.      However, if you wish to create a different background object, you will
  675.      need to override TProgram.InitDeskTop, to instantiate a new TDeskTop with
  676.      an overridden TDeskTop.NewBackground function.  NewBackground, in turn,
  677.      creates the new TBackground object by calling TBackground.Init to specify
  678.      a new background pattern.
  679.  
  680. Example:
  681.    1  { DEMOTBAC.PAS }
  682.    2  program DemoTBackground;
  683.    3  
  684.    4  uses
  685.    5    Objects, App, Views;
  686.    6  
  687.    7  type
  688.    8    TSampleProgram = object(TApplication)
  689.    9      procedure InitDeskTop; virtual;
  690.   10    end;
  691.   11  
  692.   12    PNewDeskTop = ^TNewDeskTop;
  693.   13    TNewDeskTop = object(TDeskTop)
  694.   14      procedure InitBackground; virtual;
  695.   15    end;
  696.   16  
  697.   17  var
  698.   18    SampleProgram : TSampleProgram;
  699.   19  
  700.   20  
  701.   21  procedure TNewDeskTop.InitBackground;
  702.   22  Var
  703.   23    Bounds: TRect;
  704.   24    Temp : PBackground;
  705.   25  begin
  706.   26    { Program never gets here ???? }
  707.   27    Bounds.Assign( 0, 1, 80, 24 );
  708.   28    Temp := New( PBackground, Init( Bounds, Char($FF) ) );
  709.   29    Insert(Temp);
  710.   30    Background := Temp;
  711.   31  end;
  712.   32  
  713.   33  
  714.   34  procedure TSampleProgram.InitDeskTop;
  715.   35  Var
  716.   36    Bounds: TRect;
  717.   37  begin
  718.   38    Bounds.Assign( 1, 0, 80, 24 );
  719.   39    DeskTop := New( PNewDeskTop, Init( Bounds ) );
  720.   40  end;
  721.   41  
  722.   42  
  723.   43  begin
  724.   44    with  SampleProgram  do
  725.   45    begin
  726.   46      Init;
  727.   47      Run;
  728.   48      Done;
  729.   49    end;
  730.   50  end.
  731.   51  
  732.  
  733.  
  734. Fields
  735. Pattern: Char;
  736.        Contains the bit pattern describing the background's appearance.  This
  737.      value is initialized by TDeskTop.InitBackground calling TBackground.Init.
  738.  
  739. Methods
  740. procedure Draw; virtual;
  741.        Using the palette returned by GetPalette, draws the background using the
  742.      specified Pattern.  You can override this method to create a new type of
  743.      background, say perhaps one containing text or boxes or what ever you
  744.      desire.  To do that, derive a new TDeskTop object and a new TBackground
  745.      object, using the method outline in the sample Listing above, and override
  746.      TBackground.Draw to display the background in the format that your
  747.      require.
  748.  
  749. function GetPalette: PPalette; virtual;
  750.        Returns a pointer to the CBackground color palette.  To change the color
  751.      scheme, you need to override this method (see TBackground.Draw, above).
  752.  
  753. constructor Init(var Bounds: TRect; APattern: Char);
  754.        Call TBackground.Init via TDeskTop.InitBackground, to create a new
  755.      background object of the size specified by Bounds, and having the
  756.      replicated bit pattern indicated by APattern. See: 
  757.      TDeskTop.InitBackground
  758.  
  759. constructor Load(var S: TStream);
  760.        Creates a new TBackground object and reads its attributes from stream S
  761.      by calling TView.Load, and then S.Read(Pattern).
  762.  
  763. procedure Store(var S :TStream);
  764.      Writes the TBackground object to stream S, by calling TView.Store, and
  765.      then S.Write(Pattern).
  766.  
  767.  
  768. TBufStream object
  769. ------------------------------------------------------------ 
  770. Turbo Vision Hierarchy
  771.   TObject
  772.      TStream
  773.        TDosStream
  774.           TBufStream
  775.  
  776. Discussion
  777.      The TBufStream object type is a derivative of TStream and TDosStream and
  778.      is probably the type you will most often use for writing and reading 
  779.      streams to and from disk files.  TBufStream implements a buffered version
  780.      of TDosStream, which greatly improves the speed and efficiency of stream
  781.      I/O, particularly when writing or reading a lot of small objects.   See
  782.      Chapter 15, "Streams" in the Borland Pascal Developer's Guide for a
  783.      tutorial on the use of stream I/O.
  784.      See:  TDosStream, TStream, stXXXX constants
  785.  
  786. Commonly Used Features
  787.      Generally, you will use the TBufStream.Init method to open a stream file
  788.      for access, the TBufStream.Read and TBufStream.Write methods for
  789.      performing input and output, and TBufStream.Done to close and dispose of
  790.      the object.  For random access streams, you will use TBufStream.Seek to
  791.      position the file pointer to the proper object reocrd.  You may also wish
  792.      to use TBufStream.Flush or TBufStream.Truncate, as appropriate.
  793.  
  794. Example
  795.    1  { DEMOTBUF.PAS }
  796.    2  var
  797.    3    PhoneBook : PCollection;
  798.    4    PhoneBookFile : TBufStream;
  799.    5  
  800.    6  ...
  801.    7  
  802.    8  
  803.    9  { TPersonInfo is a collection object holding name and
  804.      address information }
  805.   10  procedure TPersonInfo.Store ( var S : TStream );
  806.   11  begin
  807.   12  
  808.   13    S.Write( Name, SizeOf( Name ));
  809.   14    S.Write( Address, SizeOf( Address ));
  810.   15    S.Write( City, SizeOf( City ));
  811.   16    S.Write( State, SizeOf( State ));
  812.   17    S.Write( Zip, SizeOf( Zip ));
  813.   18    S.Write( Age, SizeOf( Age ));
  814.   19  
  815.   20  end;
  816.   21  
  817.   22  
  818.   23  constructor TPersonInfo.Load ( var S : TStream );
  819.   24  begin
  820.   25  
  821.   26    S.Read( Name, SizeOf( Name ));
  822.   27    S.Read( Address, SizeOf( Address ));
  823.   28    S.Read( City, SizeOf( City ));
  824.   29    S.Read( State, SizeOf( State ));
  825.   30    S.Read( Zip, SizeOf( Zip ));
  826.   31    S.Read( Age, SizeOf( Age ));
  827.   32  
  828.   33  end;
  829.   34  
  830.   35  ...
  831.   36  
  832.   37    { Register the PersonInfo object type }
  833.   38    RegisterType( RPersonInfo );
  834.   39  
  835.   40    { Open the stream file }
  836.   41    PhoneBookFile.Init('FONEBOOK.DAT', stCreate, 1024 );
  837.   42  
  838.   43    { Tell the PhoneBook collection to put itself to the stream }
  839.   44    PhoneBookFile.Put( PhoneBook );
  840.   45  
  841.   46    { Close the file }
  842.   47    PhoneBookFile.Done;
  843.  
  844. Fields
  845. BufEnd: Word; { Read only }
  846.      BufEnd is an index to the last used byte in Buffer.
  847.  
  848. Buffer: Pointer; { Read only }
  849.      Points to the beginning of the stream's buffer.
  850.  
  851. BufPtr: Word; { Read only }
  852.      Points to the current location in Buffer.
  853.  
  854. BufSize: Word; { Read only }
  855.      Contains the size of the buffer, in bytes.
  856.  
  857.  
  858. Methods
  859. destructor Done; virtual;
  860.      Flushes the buffer to disk, closes the file and disposes of the stream
  861.      object.
  862.  
  863. procedure Flush; virtual;
  864. Override:  Never
  865.      Forces the buffer contents to be written out to disk.
  866.  
  867. function GetPos: Longnt; virtual;
  868. Override:  Never
  869.      Gives the stream's current position relative to the start of the sream. 
  870.      Important:  This is not the same as BufPtr which is the current position
  871.      relative to the start of the current buffer only.  GetPos corresponds to
  872.      the action of Seek, below, which positions the stream's current location
  873.      to a byte location in the stream file.
  874.  
  875. function GetSize: Longint; virtual;
  876. Override:  Never
  877.      Writes the contents of the buffer out to disk (via Flush) and returns the
  878.      total number of bytes in the stream.
  879.  
  880. constructor Init( Filename: FNameStr; Mode, Size : Word);
  881.      Use Init to create and initialize a stream, using the parameters Filename
  882.      to contain the name of the file open, setting the Mode parameter to
  883.      stCreate, stOpenRead, stOpenWrite or stOpen, and Size to the number of
  884.      bytes to allocate for a buffer area.
  885.  
  886. procedure Read( var Buf; Count: Word); virtual;
  887. Override:  Never
  888.      Use Read to read Count bytes from the stream and into the Buf parameter. 
  889.      Read begins at the stream's current position (as determined by Seek or
  890.      beginning at the end of the previous Read operation).
  891.      See:  Chapter 15, "Streams" in the Borland Pascal Developer's Guide, Seek,
  892.      Write
  893.  
  894. procedure Seek(Pos : Longint); virtual;
  895. Override:  Never
  896.      Empties the contents of the Buffer to disk and then positions the current
  897.      stream position to Pos.  You can use Seek to implement random access to
  898.      stream files (see Chapter 15, "Streams").  Be certain that if you are
  899.      adding or multiplying values to compute the Pos parameter (for example,
  900.      SizeOf(SomeObject) * Index), that you convert the parameters to Longint to
  901.      avoid integer overflow errors.
  902.      See:  Chapter 15, "Streams" in the Borland Pascal Developer's Guide,
  903.      GetPos, Read, Write
  904.  
  905. procedure Truncate; virtual;
  906.      Use Truncate to flush out the Buffer, and delete all data following the
  907.      current position in the stream.
  908.  
  909. procedure Write( var Buf; Count: Word); virtual;
  910.      Use Write to copy Count bytes from the Buf parameter to the stream. 
  911.      See:  Chapter 15, "Streams" in the Borland Pascal Developer's Guide, Read
  912.  
  913.  
  914. TButton object
  915. ------------------------------------------------------------ 
  916. Turbo Vision Hierarchy
  917.   TObject
  918.      TView
  919.        TButton
  920.  
  921. Discussion
  922.      Use the TButton object to place button controls into dialog boxes.  Each
  923.      time that a button is "pressed" by clicking on it with the mouse, or using
  924.      a keyboard shortcut key or tabbing to the button and pressing SpaceBar or
  925.      Enter, the button generates a cmXXXX command.
  926.  
  927. Commonly Used Features
  928.      Generally, you need only Init a TButton object and insert it in to the
  929.      owning TGroup, which is typically a TDialog.  You rarely need to override
  930.      any of its methods or reference its fields.
  931.  
  932. Example
  933.   with  Dialog^  do
  934.   begin
  935.      { Create the Okay and Cancel buttons }
  936.      Bounds.Assign (7, 10, 16, 12 );
  937.      Insert( New( PButton, Init( Bounds, '~O~kay', cmOk,
  938.           bfDefault )));
  939.      Bounds.Assign ( 24, 10, 33, 12 );
  940.      Insert( New( PButton, Init( Bounds, '~C~ancel', cmCancel,
  941.           bfNormal )));
  942.      ...
  943.   end; { with Dialog }
  944.   Control := DeskTop^.ExecView( Dialog );
  945.  
  946. Fields
  947. AmDefault: Boolean; { Read only }
  948.      When True, this button is the default button, and when False, this is a
  949.      normal button.
  950.  
  951. Command : Word; { Read only }
  952.      Holds the command code value that is generated when the button is pressed.
  953.  
  954. Flags : Byte; { Read only }
  955.      The flags byte is a bit mapped field indicating if the label text is left
  956.      justified or center, and if the button is the default button in the group,
  957.      or is a normal, non-default button. See:  bfXXXX constants
  958.  
  959. Title : PString; { Read only }
  960.      Points the string containing the button's label text.
  961.  
  962.  
  963. Methods
  964.  
  965. destructor Done; virtual;
  966.      Disposes the memory allocated to Title and calls TView.Done.
  967.  
  968. procedure Draw; virtual;
  969. Override:  If needed.
  970.      Draws the button using the palette returned by GetPalette, and by
  971.      referencing the Flags, AmDefault and TView.State fields to display the
  972.      button as a normal button, default button or disabled button, with left
  973.      justified or centered title.
  974.  
  975. function GetPalette: PPalette; virtual;
  976. Override:  If needed.
  977.      Returns a pointer to the CButton color palette, but can be overridden to
  978.      provide other color choices.  CButton entries are intended to map into the
  979.      CDialog palette.  If, for some reason the TButton is not inserted into a
  980.      TDialog group, you will almost certainly have to override this function.
  981.  
  982. procedure HandleEvent(var Event: TEvent); virtual;
  983. Override: If needed.
  984.      Processes events received by the button.  These include mouse clicks,
  985.      keyboard short cut keys, Enter, SpaceBar, and several internal commands
  986.      used to process evBroadcast messages notifying buttons when the default
  987.      button changes.
  988.  
  989. constructor Init(var Bounds: TRect; ATitle: TTitleStr; ACommand: Word;  AFlags:
  990. Byte);
  991.      Init is the only method that you are likely to use for the TButton object.
  992.      Use Init to create a button with a size and location specified in Bounds,
  993.      and a button label specified by ATtitle.  Pass the cmXXXX command constant
  994.      to ACommand, to be returned if the button is pressed.  For the AFlags
  995.      parameter, you can pass one of the bfXXXX constants to initialize this
  996.      button as the bfDefault or bfNormal button, and can optionally or one of
  997.      the contstants with bfLeftJustify left justify the button label instead of
  998.      using the centering default. 
  999.  
  1000. constructor Load(var S: TStream);
  1001.      Creates a new instance of a TButton object and reads its definition from
  1002.      stream S.  Use the TButton.Load method, in conjunction with Store, for
  1003.      reading dialog boxes directly from resource files.  This topic is covered
  1004.      in detail in chapter 16, "Resources" in the Borland Pascal Developer's
  1005.      Guide.
  1006.      See:  TButton.Store
  1007.  
  1008. procedure MakeDefault(Enable : Boolean);
  1009.      Call a button's MakeDefault method to force the button to become the
  1010.      default button, by setting Enable to True.  If Enable is False, the
  1011.      default status of this button is removed.   Normally, this is handled
  1012.      internally to the TDialog object that owns the button.
  1013.  
  1014. procedure SetState( AState: Word; Enable: Boolean); virtual;
  1015.      If needed, call this method to change the TView.State field inherited from
  1016.      TView.  If the button becomes sfSelected or sfActive, SetState
  1017.      automatically handles making the button the default or non-default, as
  1018.      needed.
  1019.  
  1020. procedure Store( var S : TStream);
  1021.      Writes this button object out to stream S.  Use in conjunction with Load
  1022.      for the creation and reading of resource files.  See:  TButton.Load
  1023.  
  1024.  
  1025. TByteArray type
  1026. ------------------------------------------------------------ 
  1027. Declaration:       TByteArray = array[0..32767] of Byte;
  1028. Unit:       Objects
  1029. Purpose:
  1030.   TByteArray is generic array of bytes useful for typecasting.
  1031.  
  1032.  
  1033. TCheckBoxes object
  1034. ------------------------------------------------------------ 
  1035. Turbo Vision Hierarchy
  1036.   TObject
  1037.      TView
  1038.        TCluster
  1039.           TRadioButtons
  1040.           TCheckBoxes
  1041.           
  1042. Discussion
  1043.      Use TCheckBoxes to implement groups of check box controls in dialogs. 
  1044.      Eachgroup can have up to 16 check boxes, any number of which may be
  1045.      "checked" at the same time.  See Chapter 11, "Turbo Vision Tutorial" in
  1046.      the Borland Pascal Developer's Guide contains a tutorial on the creation
  1047.      and use of the TCheckBoxes object.
  1048.  
  1049. Commonly Used Features
  1050.      Normally, you create groups of checkboxes using the inherited Init method.
  1051.      Rarely will you have a need to use or override the other methods.
  1052.      See:  TCluster, TRadioButtons
  1053.  
  1054. Fields
  1055.      None
  1056.  
  1057. Methods
  1058. procedure Draw; virtual;
  1059.      Draws the checkboxes by calling TCluster.DrawBox and sets each checkbox
  1060.      indicator to "[  ]" if the item is not checked, and to "[ X ]" if the item
  1061.      is checked.  See TCluster.DrawBox for instructions on using that method to
  1062.      draw the indicators.  You only need to override this method if you plan to
  1063.      use a different type of indicator for checkboxes.
  1064.  
  1065. function Mark( Item: Integer ) : Boolean; virtual;
  1066.      The items in the check box cluster are numbered from 0 up to a maximum of
  1067.      15 items.  By passing the item number corresponding to a specific check
  1068.      box, you can test to see if the Item'th check box has been set to 
  1069.      "[ X ]".
  1070.      See:  TCheckBox.Press
  1071.  
  1072. procedure Press( Item : Integer ); virtual;
  1073.      Press sets or clears a check box item.  Like Mark, the parameter Item
  1074.      specifies which of the check boxes, from 0 up to a maximum of 15 to set or
  1075.      clear.  Press toggles the check box:  if the checked box is already
  1076.      checked, then Press clears it and vice versa.
  1077.      See:  TCheckBox.Mark
  1078.  
  1079.  
  1080. TCluster object
  1081. ------------------------------------------------------------ 
  1082. Turbo Vision Hierarchy
  1083.   TObject
  1084.      TView
  1085.        TCluster
  1086.           TRadioButtons
  1087.           TCheckBoxes
  1088.  
  1089. Discussion
  1090.      The TCluster objects are used to creat groups of dialog box controls.  
  1091.      Both TRadioButtons and TCheckBoxes inherit almost all of their
  1092.      functionality from TCluster due to their strong similarities.  
  1093.  
  1094. Commonly Used Features
  1095.      Generally, you will use either TRadioButtons or TCheckBoxes and directly
  1096.      insert those controls into dialogs.  While TCluster provides several
  1097.      fields and methods, these are primarily of interest if you are building a
  1098.      new cluster-type control.
  1099.  
  1100. Fields
  1101.  
  1102. Sel: Integer; { Read only }
  1103.      Sel indicates which of the buttons or check boxes is currently the active
  1104.      one.
  1105.  
  1106. Strings : TStringCollection; { Read only }
  1107.      Strings is a collection containing the text of all the items in the
  1108.      control group.
  1109.  
  1110. Value: Word; { Read only }
  1111.      Value holds the current setting of the control.  For TCheckBoxes, Value is
  1112.      a bit pattern where each bit indicates the state of a checked box, and for
  1113.      TRadioButtons, Value is the item number of the button that is pressed.
  1114.  
  1115. Methods
  1116. destructor Done; virtual;
  1117.      Disposes of the Strings collection and calls TView.Done.
  1118.  
  1119. function DataSize: Word; virtual;
  1120.      This function is used in conjunction with GetData and SetData, to obtain
  1121.      the SizeOf(Value).
  1122.  
  1123. procedure DrawBox(Icon: String; Marker: Char);
  1124.      DrawBox draws the status indicator for each check box or icon and is
  1125.      called by TCheckBoxes.Draw or TRadioButtons.Draw.  The Icon parameter
  1126.      holds '[  ]' for check boxes, or '( )' for radiobuttons.  Marker contains
  1127.      the character to indicate the item is selected (for example, 'x' for
  1128.      checkboxes). 
  1129.  
  1130. procedure GetData(var Rec); virtual;
  1131.      Used to copy the Value field to Rec when retrieving dialog data.
  1132.  
  1133. function GetHelpCtx: Word; virtual;
  1134.      Returns HelpCtx + Sel, where Sel is the current active item in the
  1135.      cluster.  Using this method you can produce context sensitive help for
  1136.      individual items in each cluster.
  1137.  
  1138. function GetPalette: PPalette; virtual;
  1139.      Returns a pointer to CCluster color palette.  Override this method to
  1140.      implement a different color sheme for cluster items.
  1141.  
  1142. procedure HandleEvent(var Event: TEvent); virtual;
  1143.      Handles selection of cluster items through the keyboard movement keys and
  1144.      SpaceBar (to toggle a selection).  Other events are passed through to
  1145.      TView.HandleEvent.
  1146.  
  1147. constructor Init( var Bounds: TRect; AStrings: PSItem);
  1148.      Use Init and nested calls to NewSItem to create an entire list of cluster
  1149.      items within the area described by Bounds.  Normally, TCluster.Init is
  1150.      called via the derived objects TRadioButtons.Init or TCheckBoxes.Init, as
  1151.      shown in this example:
  1152.  
  1153.      Bounds.Assign( 24, 2, 40, 5);
  1154.      ColorOptions := New( PRadioButtons, Init( Bounds,
  1155.                    NewSItem('~C~olor',
  1156.                    NewSItem('~M~onochrome',
  1157.                    NewSItem('~B~&W',
  1158.                    nil)))
  1159.                    ));
  1160.      Insert( ColorOptions );
  1161.      Bounds.Assign( 24, 1, 40, 2);
  1162.      Insert( New( PLabel, Init( Bounds, 'Color schemes',
  1163.             ColorOptions )));
  1164.  
  1165. constructor Load(var S: TStream);
  1166.      Creates a new TCluster object and loads the appropriate values (TView.Load
  1167.      and Value and Sel fields) from stream S.
  1168.  
  1169. function Mark(Item: Integer): Boolean; virtual;
  1170.      Mark is always overridden by the object that is derived from TCluster and
  1171.      is used to obtain the setting of the Item'th control in the cluster.  If
  1172.      the Item'th control is set, as for example, a check box is currently
  1173.      selected, then Mark should return True.  If the control is not currently
  1174.      set, then Mark should return False.
  1175.      See:  TCheckBoxes.Mark, TRadioButtons.Mark
  1176.  
  1177. procedure MovedTo(Item: Integer); virtual;
  1178.      MovedTo moves the active location within the cluster to the Item'th
  1179.      control.
  1180.  
  1181. procedure Press(Item: Integer); virtual;
  1182.      Press is always overridden by TCluster descendants to set or clear a check
  1183.      box item, or to set or clear a specific radio button.  
  1184.  
  1185. procedure SetData(var Rec); virtual;
  1186.      SetData copies Value field from Rec and draw's the cluster.  SetData is
  1187.      used in conjunction with GetData to access the dialog data.  See Chapter
  1188.      12, "Turbo Vision List Boxes" in the Borland Pascal Developer's Guide for
  1189.      an example.
  1190.  
  1191. procedure SetState(AState: Word; Enable: Boolean); virtual;
  1192.      TCluster.SetState passes its parameters to TView.SetState, and if the
  1193.      view's State is sfSelected , then calls TView.DrawView.
  1194.  
  1195. procedure Store(var S: TStream);
  1196.      Call's TView.Store(S) and then writes the contents of Value and Sel out to
  1197.      stream S. 
  1198.      See:  TCluster.Load, Chapter 15, "Streams" in the Borland Pascal
  1199.      Developer's Guide.
  1200.  
  1201.  
  1202. TCollection object
  1203. ------------------------------------------------------------ 
  1204. Turbo Vision Hierarchy
  1205.   TObject
  1206.      TCollection
  1207.        TSortedCollection
  1208.        TStringCollection
  1209.        TResourceCollection
  1210.  
  1211. Discussion
  1212.           Collections provide a mechanism for storing and accessing arbitrary
  1213.      collections of data.  You can think of a collection as working like a
  1214.      dynamically sizeable array of data, that can be enlarged as your data
  1215.      requirements increase.  Several specialized collections are derived from
  1216.      TCollection, including TSortedCollection, TStringCollection and
  1217.      TResourceCollection.  The latter is used internally to the resource file
  1218.      mechanism and is not generally used by application programs.
  1219.           While collections are defined within Turbo Vision, you can also use
  1220.      collections in standard, non-Turbo Vision applications.
  1221.           In the description of the methods below, each method using an Index
  1222.      parameter checks to insure that the Index is in the valid range between 0
  1223.      and Count (the number of items in the collection).  If the Index is out
  1224.      range, these methods call TCollection.Error which, by default, halts the
  1225.      program with a run time error.  You can trap any collection error by
  1226.      overriding Error in your derived collection.
  1227.      See:  Chapter 14, "Collections" in the Borland Pascal Developer's Guide
  1228.      for complete details and a tutorial on the use of the TCollections object
  1229.      type.
  1230.  
  1231. Commonly Used Features
  1232.      TCollection.Count field, TCollection.Init, TCollection.Init, the access
  1233.      methods At, AtPut, AtDelete, AtFree, the iterators FirstThat, ForEach and
  1234.      LastThat, the IndexOf function, and the Load and Store methods.
  1235.  
  1236. Example
  1237.      See Chapter 14, "Collections" in the Borland Pascal Developer's Guide, for
  1238.      several examples.
  1239.  
  1240. Fields
  1241.  
  1242. Count: Integer;
  1243.      Holds the number of items currently stored in the collection.
  1244.  
  1245. Delta: Integer;
  1246.      Because one of the features of collections is that they can grow, Delta
  1247.      holds the number of elements by which the collection should be enlarged
  1248.      when the Count reaches the current maximum size specified by Limit.  When
  1249.      this occurs, Limit is increased by Delta and additional space is allocated
  1250.      for the necessary Item pointers.  Generally, Limit should initially be set
  1251.      to a sufficient size for most operations on the collection, and Delta
  1252.      should be set large enough so that expansion of the collection occurs
  1253.      infrequently to avoid the fairly intensive overhead of dynamically
  1254.      resizing the collection.
  1255.      See:  TCollection.Init, TCollection.Limit, TCollection.Items
  1256.  
  1257. Items: PItemList;
  1258.      Items points to an array that contains pointers to the individual items in
  1259.      the collection.
  1260.  
  1261. Limit: Integer;
  1262.      Holds the current number of elements allocated to the collection.
  1263.      See:  Delta, TCollection.Init
  1264.  
  1265. Methods
  1266.  
  1267. function At(Index : Integer): Pointer;
  1268.      Use At to access the collection as if it were an array.  At(Index) returns
  1269.      a pointer to the Index'th item in the array, where Index ranges from 0 up
  1270.      to Count.  
  1271.      See:  TCollection.IndexOf() as the inverse of At
  1272.  
  1273. procedure AtDelete(Index: Integer);
  1274.      AtDelete deletes the item at the location specified by Index, and slides
  1275.      all of the following items in the collection over to fill in the now
  1276.      vacant hole and decrements Count by 1.  AtDelete does not dispose of the
  1277.      actual item that was in the location.  Therefore, be sure to save a
  1278.      pointer to the item first, and then to separately dispose of the specific
  1279.      item using Dispose( ItemPtr, Done ).  
  1280.      See:  TCollection.AtFree , TCollection.Delete, TCollection.Free
  1281.  
  1282. procedure AtFree(Index: Integer);]
  1283.      AtFree works like AtDelete, except that the specific item being deleted is
  1284.      also disposed of.  If you do not need to retain a pointer to the specific
  1285.      item in the collection for future processing, you will probably want to
  1286.      use AtFree in place of AtDelete for deleting items from the collection. 
  1287.      See:TCollection.AtDelete, TCollection.Delete, TCollection.Free
  1288.  
  1289. procedure AtInsert(Index: Integer; Item: Pointer);
  1290.      AtInsert puts a new Item into the collection at the Index location by
  1291.      sliding all of the following items over by one position.  If adding the
  1292.      new element would exceed the size of the collection, TCollection.SetLimit
  1293.      is called to automatically expand the size.
  1294.      See:  TCollection.At,TCollection.AtPut, TCollection.SetLimit
  1295.  
  1296. procedure AtPut(Index: Integer; Item: Pointer);
  1297.      Use AtPut when you need to replace an existing item with a new item.  APut
  1298.      copies the new Item pointer to the location specified by Index.
  1299.  
  1300. procedure Delete(Item: Pointer);
  1301.      The items in a collection can be accessed via their index location or by
  1302.      way of the pointer to the item.  When you have a pointer to an item and
  1303.      wish to delete it, you can call Delete(Item) directly.  Alternatively, you
  1304.      can use the IndexOf() function to translate the pointer into an Index
  1305.      value and then use AtDelete, like this,
  1306.           AtDelete(IndexOf(Item));
  1307.      After an item is deleted, Count is decremented by 1.
  1308.      See:  TCollection.AtDelete, TCollection.AtFree, TCollection.Free,
  1309.      TCollection.IndexOf
  1310.  
  1311. procedure DeleteAll;
  1312.      Sets Count to 0, effectively deleting all items in the collection.
  1313.      See:  TCollection.AtDelete,TCollection. Delete
  1314.  
  1315. destructor Done; virtual;
  1316.      Always call a collection's Done method to dispose of each item and free up
  1317.      the memory used by the collection.
  1318.  
  1319. procedure Error(Code, Info: Integer); virtual;
  1320. Override:  As needed.
  1321.      All collection errors result in a call to Error, with error information
  1322.      passed in Code and Info.
  1323.      See: coXXXX constants.
  1324.  
  1325. function FirstThat(Test: Pointer): Pointer;
  1326.      FirstThat is one of the iterator functions and is normally used to search
  1327.      through the collection for a specific item.  Test should point to a
  1328.      locally defined far procedure, returning True when it matches the search
  1329.      pattern and False otherwise.  For each item in the collection until
  1330.      finding a match, FirstThat calls the Test function.
  1331.      See:  Chapter 14, "Collections" for a detailed example.
  1332.  
  1333. procedure ForEach(Action: Pointer);
  1334.      ForEach is an iterator function to scan through every item in the
  1335.      collection, and call the procedure specified by the Action pointer,
  1336.      passing to it a pointer to each individual item.  
  1337.      See:  Chapter 14, "Collections" for a detailed example.
  1338.  
  1339. procedure Free(Item: Pointer);
  1340.      This procedure is similar to Delete, except that Free also disposes of the
  1341.      memory occupied by the item.  Free is equivalent to calling,
  1342.           Delete(Item);
  1343.           FreeItem(Item);
  1344.      Although, Borland recommends not calling FreeItem directly.
  1345.      See:  TCollection.AtFree,TCollection. AtDelete, TCollection.Delete,
  1346.      TCollection.FreeAll
  1347.  
  1348. procedure FreeAll;
  1349.      Disposes of each item in the collection and sets Count to 0.
  1350.  
  1351. procedure FreeItem(Item: Pointer); virtual;
  1352.      When Item is a pointer to an individual item in the collection,
  1353.      FreeItem(Item) disposes Item by calling Dispose(PObject(Item), Done),
  1354.      using PObject to recast the pointer to a generic PObject.
  1355.      See:  TCollection.AtFree, TCollection.AtDelete, TCollection.Delete, Free
  1356.  
  1357. function GetItem(var S: TStream): Pointer; virtual;
  1358.      GetItem is used to read a single collection item from stream S and is
  1359.      automatically called by TCollection.Load.  You should not directly call
  1360.      this routine but should use Load instead.
  1361.      See:  TCollection.Load,  TCollection.PutItem, TCollection.Store
  1362.  
  1363. function IndexOf(Item: Pointer): Integer; virtual;
  1364.      Given a pointer to an Item, IndexOf returns the index position in the
  1365.      collection where the Item is located.  IndexOf is the opposite of
  1366.      At(Index) which returns a pointer to the item.
  1367.      See:  TCollection.At
  1368.  
  1369. constructor Init(ALimit, ADelta: Integer);
  1370.      TCollection.Init creates a new collection with space initially allocated
  1371.      for the number of elements specified by ALimit, and the ability to
  1372.      dynamically increase the size of the collection in ADelta increments.
  1373.      See:  MaxCollectionSize
  1374.  
  1375. procedure Insert(Item: Pointer); virtual;
  1376.      Inserts or adds the specified Item to the end of the collection and is
  1377.      equivalent to calling AtInsert(Item, Count).
  1378.      See:  TCollection.AtInsert
  1379.  
  1380. function LastThat(Test: Pointer); Pointer;
  1381.      LastThat searches backwards through the collection, beginning at the last
  1382.      item and moving forwards.  For each item, LastThat calls the function
  1383.      specified by Test, until Test returns a True result.  By having Test point
  1384.      to a function that makes a comparision between a search criteria and an
  1385.      item in the collection, you can use LastThat to quickly scan backwards in
  1386.      a collection.
  1387.      See:  TCollection.FirstThat, TCollection.ForEach
  1388.  
  1389. constructor Load(var S: TStream);
  1390.      Loads the entire collection from stream S, by calling TCollection.GetItem
  1391.      for each individual item in the collection.
  1392.      See:  TCollection.GetItem
  1393.  
  1394. procedure Pack;
  1395.      Use Pack to eliminate all nil pointers that may have been stored into the
  1396.      collection.
  1397.  
  1398. procedure PutItem(var S: TStream; Item: Pointer); virtual;
  1399.      Called by TCollection.Store to write an individual item to stream S.
  1400.  
  1401. procedure SetLimit(ALimit: Integer); virtual;
  1402.      Use SetLimit to manually adjust the number of elements allocated to the
  1403.      collection.  SetLimit operates by allocating a new Items array and copying
  1404.      the appropriate number of elements from the old Items array into the new
  1405.      array.
  1406.      See:  TCollection.Items, TCollection.Limit
  1407.  
  1408. procedure Store(var S: TStream);
  1409.      Writes the entire collection to stream S.
  1410.      See:  TCollection.Load, TCollection.PutItem
  1411.  
  1412.  
  1413. TCommandSet type
  1414. ------------------------------------------------------------ 
  1415. Declaration:       
  1416.      TCommandSet = set of Byte;
  1417.  
  1418. Unit:     Views
  1419.  
  1420. Purpose:
  1421. In Turbo Vision, command codes are assigned values from 0 to 65,535, with
  1422. values in the range of 0 to 255 reserved for items that can be selectively
  1423. disabled.  TCommandSet is used to hold a set of up to 256 commands,
  1424. specifically those that can be disabled, and is used as a parameter for the
  1425. TView methods, EnableCommands, DisableCommands, GetCommands and SetCommands.
  1426. Listing TCMDSET.PAS illustrates the use of a TCommandSet type.
  1427.    1  { TCMDSET.PAS }
  1428.    2  { Example using TCommandSet, from TVSHELL8.PAS }
  1429.    3  var
  1430.    4    CommandsOn : TCommandSet;
  1431.    5    CommandsOff : TCommandSet;
  1432.    6    ...
  1433.    7    CommandsOn := [cmUseDOS, cmDelete];
  1434.    8    CommandsOff := CommandsOn;
  1435.    9  
  1436.   10    if  (SetUpData.ProgOptions and 2) = 2  then
  1437.   11      CommandsOff := CommandsOff - [cmUseDOS];
  1438.   12  
  1439.   13    if  (SetUpData.ProgOptions and 4) = 4  then
  1440.   14      CommandsOff := CommandsOff - [cmDelete];
  1441.   15  
  1442.   16    CommandsOn := CommandsOn - CommandsOff;
  1443.   17  
  1444.   18    DisableCommands( CommandsOff );
  1445.   19    EnableCommands( CommandsOn );
  1446.  
  1447.  
  1448. TDeskTop object
  1449. ------------------------------------------------------------ 
  1450. Turbo Vision Hierarchy
  1451.   TObject
  1452.      TView
  1453.      TGroup
  1454.        TDeskTop
  1455.        TWindow
  1456.        TProgram
  1457.  
  1458. Discussion
  1459.      Each application has one TDeskTop object, pointed to by the global
  1460.      variable, DeskTop, that controls the area on the screen between the menu
  1461.      bar and the statusline. The TDeskTop object owns the TBackground that
  1462.      forms the backdrop for the screen, and typically owns other windows and
  1463.      dialogs that become inserted into the desktop during program execution.  
  1464.  
  1465. Commonly Used Features
  1466.      TDeskTop provides two functions for rearranging the windows:  Cascade and
  1467.      Tile.  Most applications will not need to manipulate the TDeskTop object
  1468.      other than to insert windows and control the operation of dialogs through
  1469.      the inherited ExecView method.  If you wish to change the background
  1470.      object, you'll need to derive a new TDeskTop object and override the
  1471.      InitBackground procedure described below.
  1472.  
  1473. Example
  1474.      Windows used by the application are normally inserted into the TDeskTop
  1475.      object.  For example, the TVSHELL sample program (see Chapters 11-12 of
  1476.      the Borland Pascal Developer's Guide) creates and inserts a directory
  1477.      window using the global DeskTop^ pointer, like this:
  1478.  
  1479.   GetExtent( Bounds );
  1480.   Bounds.B.Y := Bounds.B.Y - 2;  { We leave space for the status
  1481.                                    line }
  1482.   DirWindow := New( PDirectoryWindow, 
  1483.           Init(Bounds, 'Directory Listing', 0 ));
  1484.   DeskTop^.Insert(DirWindow);
  1485.  
  1486.      Modal dialog boxes are displayed on the desktop by calling the ExecView
  1487.      method, like this:
  1488.  
  1489.   { Let the user fiddle with the dialog box }
  1490.   Control := DeskTop^.ExecView (Dialog);
  1491.   if  Control <> cmCancel  then
  1492.   begin
  1493.      Dialog^.GetData( SetUpData );
  1494.      ...
  1495.   end;
  1496.  
  1497.      Non-modal dialog boxes are treated the same as a window and are inserted
  1498.      directly using Insert, as shown in the directory window example above.
  1499.           For an example of deriving a TDeskTop object to implement a new
  1500.      background, see TBackground.
  1501.  
  1502. Fields
  1503. Background: PBackground;
  1504.      Points to the TBackground object owned by this TDeskTop (note:  This field
  1505.      is omitted from the Borland documentation).
  1506.  
  1507. Methods
  1508. procedure Cascade(var R: TRect);
  1509.      Calling Cascade produces a "cascade effect" of all the windows currently
  1510.      owned by the desktop.  The effect is identical to that used by the IDE
  1511.      editor when multiple files are opened:  the window that appears farthest
  1512.      to the back is drawn to occupy the entire screen, and then each subsequent
  1513.      window is sized and positioned such that its upper left corner appears one
  1514.      line down and one character to the right of the window behind it.  
  1515.      See:  TDeskTop.Tile
  1516.  
  1517. constructor Init(var Bounds : TRect );
  1518.      Init creates a new TDeskTop with the size and position given by Bounds,
  1519.      and then calls InitBackground to create a new TBackground object.
  1520.      See:  TBackground, TDeskTop.InitBackground
  1521.  
  1522. procedure InitBackground; virtual;
  1523. Override:  As needed to create new TBackground objects
  1524.      InitBackground calls TBackground.Init to instantiate a new background
  1525.      object, and sets Background to point to the TBackground object.  If you
  1526.      wish to create a different appearing background thann the default
  1527.      background, there are two ways to go about it.  One is to merely insert a
  1528.      new TBackground object into the desktop so that it hides the previous
  1529.      desktop.  To do this, you would write,
  1530.           DeskTop^.Insert(New(PBackground, Init(Bounds, #FF));
  1531.      where Bounds defines the size and location of the new background object,
  1532.      and #FF is a hexadecimal character describing the pattern to use in
  1533.      drawing the new backdrop.  While this method is easy to implement, the
  1534.      original background continues to occupy memory.  A better approach is to
  1535.      use the method given as an example in the TBackground section, where a new
  1536.      TDeskTop object is derived and its InitBackground function is overridden
  1537.      to instantiate a new TBackground.  Using this approach, when the
  1538.      application runs, it automatically calls your TDesktop-derived object's
  1539.      InitBackground method, creating only one new background. 
  1540.      See:  TBackground for complete details.
  1541.      Important:  Borland's documentation describes a method called
  1542.      NewBackground to perform the operation of InitBackground.  However, in the
  1543.      actual implementation of Turbo Vision, NewBackground was replaced with
  1544.      InitBackground.
  1545.  
  1546. procedure HandleEvent(var Event: TEvent); virtual;
  1547.      TDeskTop.HandleEvent exists primarily to intercept the F6 key, used to
  1548.      cycle through the collection of windows that it owns.
  1549.  
  1550. function NewBackground: PView; virtual;
  1551.      This function, described in the Borland documentation does not exist.  See
  1552.      InitBackground.
  1553.  
  1554. procedure Tile(var R: TRect);
  1555.      Displays tileable windows, in tiled format, on to the screen.
  1556.  
  1557. procedure TileError; virtual;
  1558. Override:  As needed.
  1559.      If for some reason Turbo Vision is unable to rearrange and draw the
  1560.      windows in either cascaded or tiled format, Turbo Vision will call the
  1561.      TDeskTop.TileError procedure.  Normally, this procedure does nothing and
  1562.      returns.  However, if you wish to detect the condition and provide a
  1563.      message to the user, you can override this procedure.
  1564.  
  1565.  
  1566. TDialog object
  1567. ------------------------------------------------------------ 
  1568. Turbo Vision Hierarchy
  1569.   TObject
  1570.      TView
  1571.        TGroup
  1572.           TWindow
  1573.             TDialog
  1574.  
  1575. Discussion
  1576.      Use TDialog to derive new types of dialog box objects.  In most cases, you
  1577.      will use the existing TDialog-type directly, and only reference its Init
  1578.      method.  Dialogs are then inserted into the desktop, or executed via
  1579.      DeskTop^.ExecView.  Generally, you will not need to access the dialog
  1580.      methods directly.  By default, dialog boxes cannot grow, but can be
  1581.      dragged or closed via a close icon.
  1582.  
  1583. Fields
  1584.      None
  1585.  
  1586. Methods
  1587. function GetPalette: PPalette; virtual;
  1588. Override:  As needed to define new color mappings.
  1589.      Returns a pointer to the CDialog palette, defining the basic color
  1590.      mappings for dialogs and all the controls that are inserted into dialogs. 
  1591.  
  1592.  
  1593. procedure HandleEvent(var Event: TEvent); virtual;
  1594.      Adds special processing of events to generate cmCancel, cmDefault, cmYes
  1595.      or cmNo commands in response to the appropriate inputs.
  1596.  
  1597. constructor Init(var Bounds: TRect; ATitle: TTitleStr);
  1598.      Passes the parameters Bounds and ATtitle to TWindow.Init to create a
  1599.      dialog box window with defaults set such that the dialog window cannot
  1600.      grow but can be dragged or closed.
  1601.  
  1602. function Valid(Command: Word): Boolean; virtual;
  1603.      If  the Command parameter equals cmCommand, then Valid returns True. 
  1604.      Otherwise, when Command is cmValid (or zero), Valid checks the Valid
  1605.      method of each of the controls that it owns in order to determine if the
  1606.      entire dialog was constructed satisfactorily.  All of the controls must
  1607.      return True in order for TDialog.True to return True.
  1608.      See:  TView.Valid, Chapters 16 and 19.
  1609.  
  1610.  
  1611. TDosStream object
  1612. ------------------------------------------------------------ 
  1613. Turbo Vision Hierarchy
  1614.   TObject
  1615.      TStream
  1616.        TDosStream
  1617.           TBufStream
  1618.  
  1619. Discussion
  1620.      Use TDosStream for unbuffered stream file access (see also TBufStream). 
  1621.      For most applications you will probably prefer to use TBufStream for its
  1622.      faster, buffered file access.
  1623.      See  TStream, TBufStream, stXXXX constants
  1624.  
  1625. Commonly Used Features
  1626.      Generally, you will use the TDosStream.Init method to open a stream file
  1627.      for access, the TDosStream.Read and TDosStream.Write methods for
  1628.      performing input and output, and TDosStream.Done to close and dispose of
  1629.      the object.  For random access streams, you will use TBufStream.Seek to
  1630.      position the file pointer to the proper object record.
  1631.  
  1632. Example
  1633.      The use of TDosStream is nearly identical to TBufStream, without the
  1634.      buffering related methods.  See the TBufStream example and also Chapter
  1635.      15, "Streams" in the Borland Pascal Developer's Guide for information
  1636.      regarding the use of streams.
  1637.  
  1638. Fields
  1639. Handle: Word; { Read only }
  1640.      Contains the DOS file handle used to access the file containing the
  1641.      stream.
  1642.  
  1643. Methods
  1644. destructor Done; virtual;
  1645.      Closes the file and disposes of the stream object.
  1646.  
  1647. function GetPos: Longnt; virtual;
  1648. Override:  Never.
  1649.      Gives the stream's current position, in bytes, relative to the start of
  1650.      the stream.
  1651.  
  1652. function GetSize: Longint; virtual;
  1653. Override:  Never.
  1654.      Returns the total number of bytes in the stream.
  1655.  
  1656. constructor Init( Filename: FNameStr; Mode, Size : Word);
  1657.      Use Init to create and initialize a stream, using the parameters Filename
  1658.      for  the name of the file to open, and setting the Mode parameter to
  1659.      stCreate, stOpenRead, stOpenWrite or stOpen.
  1660.  
  1661. procedure Read( var Buf; Count: Word); virtual;
  1662. Override:  Never
  1663.      Use Read to read Count bytes from the stream and into the Buf parameter. 
  1664.      Read begins at the stream's current position (as determined by Seek or
  1665.      beginning at the end of the previous Read operation).
  1666.      See:  Chapter 15, "Streams", TOosStream.Seek, TDosStream.Write
  1667.  
  1668. procedure Seek(Pos : Longint); virtual;
  1669. Override:  Never.
  1670.      Positions the current stream position to Pos.  You can use Seek to
  1671.      implement random access to stream files (see Chapter 15, "Streams").  Be
  1672.      certain that if you are adding or multiplying values to compute the Pos
  1673.      parameter (for example, SizeOf(SomeObject) * Index), that you convert the
  1674.      parameters to Longint to avoid integer overflow errors.
  1675.      See:  Chapter 15, "Streams", TDosStream.GetPos,TDosStream.Read,
  1676.      TDosStream.Write
  1677.  
  1678. procedure Truncate; virtual;
  1679. Override:  Never.
  1680.      Use Truncate to delete all data following the current position in the
  1681.      stream.
  1682.  
  1683. procedure Write( var Buf; Count: Word); virtual;
  1684. Override:  Never.
  1685.      Use Write to copy Count bytes from the Buf parameter to the stream. 
  1686.      See:  Chapter 15, "Streams", TDosStream.Read
  1687.  
  1688.  
  1689. TDrawBuffer type
  1690. ------------------------------------------------------------ 
  1691. Declaration:       
  1692.      TDrawBuffer = arrayu[0..MaxViewWidth-1] of Word;
  1693.  
  1694. Unit:     Views
  1695.  
  1696. Purpose:
  1697.      TDrawBuffer is used to create temporary storage areas for a line of text
  1698.      to be written to the screen where the low byte of each word contains the
  1699.      character value, and the high byte contains the video attribute byte.  You
  1700.      can use the Turbo Vision procedures, MoveBuf, MoveChar, MoveCStr, and
  1701.      MoveStr to set up the buffer and then use one of the TView method's
  1702.      WriteBuf or WriteLine within a Draw method to write the output to the
  1703.      screen.  Here's an example using TDrawBuffer:
  1704.  
  1705. var
  1706.   Buffer : TDrawBuffer;
  1707.   ...
  1708.   MoveStr(Buffer, 'Financial Results for FY1991', GetColor(1) );
  1709.   WriteLine( 1, 3, 28, 1, Buffer );
  1710.  
  1711. See:  TView methods WriteBuf and WriteLine.
  1712.  
  1713.  
  1714. TEmsStream object
  1715. ------------------------------------------------------------ 
  1716. Turbo Vision Hierarchy
  1717.   TObject
  1718.      TStream
  1719.        TEmsStream
  1720.  
  1721. Discussion
  1722.      Use TEmsStream for storing stream files in EMS memory.  Important:  If you
  1723.      fail to call TEmsStream.Done, or if your program suffers an abnormal
  1724.      termination (i.e. "crashes"), the EMS will remain allocated.  The only way
  1725.      to recover allocated EMS is to reboot the computer.
  1726.      See:  TStream, TBufStream, TDosStream, stXXXX constants
  1727.  
  1728. Commonly Used Features
  1729.      Generally, you will use the TEmsStream.Init method to open a stream for
  1730.      access, the TEmsStream.Read and TEmsStream.Write methods for performing
  1731.      input and output, and TEmStream.Done to close and dispose of the object. 
  1732.      For random access streams, you will use TEmsStream.Seek to position the
  1733.      file pointer to the proper object reocrd.
  1734.  
  1735. Example
  1736.      See Chapter 15, "Streams" for a tutorial and examples of using TEmsStream.
  1737.  
  1738. Fields
  1739. Handle: Word; { Read only }
  1740.      Contains the EMS file handle used to access the stream.
  1741.  
  1742. PageCount: Word;
  1743.      Contains the total number of 16k byte pages allocated for the TEmsStream
  1744.      object.
  1745.  
  1746. Position: Longint;
  1747.      Contains the current location within the stream, beginning from byte 0.
  1748.  
  1749. Size: Longint;
  1750.      Contains the total size of the stream, in bytes.
  1751.  
  1752. Methods
  1753. destructor Done; virtual;
  1754.      Disposes and releases the EMS memory pages used by the stream.
  1755.  
  1756. function GetPos: Longnt; virtual;
  1757. Override:  Never.
  1758.      Gives the stream's current position, in bytes, relative to the start of
  1759.      the stream.
  1760.  
  1761. function GetSize: Longint; virtual;
  1762. Override:  Never.
  1763.      Returns the total number of bytes in the stream.
  1764.  
  1765. constructor Init( MinSize, MaxSize : Longint);
  1766.      Use Init to create an initialize the TEmsStream such that the stream will
  1767.      always have at least the minimum specified MinSize memory allocated to it.
  1768.      The exact allocation depends on the version of the EMS driver in use on
  1769.      your computer.  If your EMS driver is version 4.0 or greater, then MaxSize
  1770.      is ignored.  In 4.0 and greater, EMS blocks are dynamically resizeable so
  1771.      this parameter is ignored.  Prior to version 4.0, the EMS blocks could not
  1772.      be resized and in that case Init will initially try to allocate the entire
  1773.      MaxSize bytes.
  1774.  
  1775. procedure Read( var Buf; Count: Word); virtual;
  1776. Override:  Never
  1777.      Use Read to read Count bytes from the stream and into the Buf parameter. 
  1778.      Read begins at the stream's current position (as determined by Seek or
  1779.      beginning at the end of the previous Read operation).
  1780.      See:  Chapter 15, "Streams" in the Borland Pascal Developer's Guide,
  1781.      TEmsStream.Seek, TEmsStream.Write
  1782.  
  1783. procedure Seek(Pos : Longint); virtual;
  1784. Override:  Never.
  1785.      Positions the current stream position to Pos.  You can use Seek to
  1786.      implement random access to streams  (see Chapter 15, "Streams").  Be
  1787.      certain that if you are adding or multiplying values to compute the Pos
  1788.      parameter (for example, SizeOf(SomeObject) * Index), that you convert the
  1789.      parameters to Longint to avoid integer overflow errors.
  1790.      See:  Chapter 15, "Streams", TEmsStream.GetPos,TEmsStream.Read,
  1791.      TEmsStream.Write
  1792.  
  1793. procedure Truncate; virtual;
  1794. Override:  Never.
  1795.      Use Truncate to delete all data following the current position in the
  1796.      stream, resetting the current position to the end of the stream.
  1797.  
  1798. procedure Write( var Buf; Count: Word); virtual;
  1799. Override:  Never.
  1800.      Use Write to copy Count bytes from the Buf parameter to the stream. 
  1801.      See:  Chapter 15, "Streams", TEmsStream.Read
  1802.  
  1803.  
  1804. TEvent type
  1805. ------------------------------------------------------------
  1806. Declaration:       
  1807. The TEvent type, as defined in Turbo Pascal 6.0, (C) Copyright 1991, by Borland
  1808. Intl:
  1809.  
  1810.    1  { TEVENT.PAS }
  1811.    2    PEvent = ^TEvent;
  1812.    3    TEvent = record
  1813.    4      What: Word;
  1814.    5      case Word of
  1815.    6        evNothing: ();
  1816.    7        evMouse: (
  1817.    8          Buttons: Byte;
  1818.    9          Double: Boolean;
  1819.   10          Where: TPoint);
  1820.   11        evKeyDown: (
  1821.   12          case Integer of
  1822.   13            0: (KeyCode: Word);
  1823.   14            1: (CharCode: Char;
  1824.   15                ScanCode: Byte));
  1825.   16        evMessage: (
  1826.   17          Command: Word;
  1827.   18          case Word of
  1828.   19            0: (InfoPtr: Pointer);
  1829.   20            1: (InfoLong: Longint);
  1830.   21            2: (InfoWord: Word);
  1831.   22            3: (InfoInt: Integer);
  1832.   23            4: (InfoByte: Byte);
  1833.   24            5: (InfoChar: Char));
  1834.   25    end;
  1835.  
  1836. Unit:       Drivers
  1837. Purpose:
  1838.      TEvent is a case variant record defining each type of event used in Turbo
  1839. Vision.  When a routine receives an event, it can look in the TEvent fields to
  1840. determine what type of event occurred and use other information provided to
  1841. appropriately process that event.  For example, when the TEvent.What field
  1842. contains evMouse, you can check TEvent.Buttonsto see which mouse button was
  1843. pressed (0=none, 1=left, 2=right).  The TEvent.Double flag is set if two mouse
  1844. clicks occurred within the DoubleDelay time interval.  Lastly, for each mouse
  1845. event, TEvent.Where contains the coordinates of the mouse.
  1846.      When the event record contains broadcast evMessage events, several variant
  1847. fields are provided for passing additional information with the message. 
  1848. InfoPtr can be used, for instance, to pass a pointer to a record or another
  1849. object. 
  1850. See:  Chapter 13, "More Turbo Vision Features" in the Borland Pascal
  1851. Developer's Guide for additional information regarding event processing, and
  1852. also see the HandleEvent method defined in various object types.
  1853.  
  1854.